export default {
	dateOptions: {
		disabledDate(time) {
			return time.getTime() > Date.now();
		},
		shortcuts: [
			{
				text: "今天",
				onClick(picker) {
					picker.$emit("pick", new Date());
				}
			}, {
				text: "昨天",
				onClick(picker) {
					picker.$emit("pick", new Date(Date.now() - 24 * 60 * 60 * 1000));
				}
			}, {
				text: "一周前",
				onClick(picker) {
					picker.$emit("pick", new Date(Date.now() - 7 * 24 * 60 * 60 * 1000));
				}
			}
		]
	},
	weekOptions: {
		firstDayOfWeek: 1, //周起始日为星期一
		disabledDate(value) {
			let today = new Date(); //获取今天日期
			let d = today.getDay(); //计算今天是周几。如果是周天，d=0
			let w = d === 0 ? 7 : d;
			let endTime = today.getTime() + (7 - w) * 24 * 60 * 60 * 1000;
			return value.getTime() > endTime; //不可选本周日以后的时间
		}
	},
	rangeOptions: {
		shortcuts: [
			{
				text: "最近一周",
				onClick(picker) {
					picker.$emit("pick", [new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), new Date()]);
				}
			}, {
				text: "最近一个月",
				onClick(picker) {
					picker.$emit("pick", [new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), new Date()]);
				}
			}, {
				text: "最近三个月",
				onClick(picker) {
					picker.$emit("pick", [new Date(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000), new Date()]);
				}
			}, {
				text: "最近半年",
				onClick(picker) {
					picker.$emit("pick", [new Date(Date.now() - 6 * 30 * 24 * 60 * 60 * 1000), new Date()]);
				}
			}, {
				text: "最近一年",
				onClick(picker) {
					picker.$emit("pick", [new Date(Date.now() - 365 * 24 * 60 * 60 * 1000), new Date()]);
				}
			}
		]
	}
};
